package desens

import "strings"

// DesensitizationTel 手机号脱敏
// 158 **** 5768
func DesensitizationTel(tel string) string {
	if len(tel) != 11 {
		return ""
	}
	return tel[:3] + "****" + tel[7:]
}

// DesensitizationEmail 邮箱脱敏
// rootwxd@163.com ---> r******@163.com
func DesensitizationEmail(email string) string {
	eList := strings.Split(email, "@") //将邮箱使用@符号分为两部分
	if len(eList) != 2 {
		return ""
	}
	return eList[0][:1] + "****@" + eList[1]
}
